package com.mapapp.flutter_mapapp.adapter;

import android.graphics.Color;
import android.support.annotation.NonNull;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mapapp.flutter_mapapp.R;
import com.mapapp.flutter_mapapp.bean.FixBean;

public class ErrorCorrectionAdapter extends BaseQuickAdapter<FixBean, BaseViewHolder> {
    public ErrorCorrectionAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, FixBean item) {
        int state = item.getState();
        TextView tvHousehold = helper.getView(R.id.tv_household);
        ImageView ivStatus = helper.getView(R.id.iv_status);
        TextView tvStatus = helper.getView(R.id.tv_status);

        switch (item.getType()) {
            case 0:
                tvHousehold.setText(item.getRegion_name() + "-合户");
                break;
            case 1:
                tvHousehold.setText(item.getRegion_name() + "-分户");
                break;
        }


        switch (state) {
            case 0:  //未审核
                tvStatus.setText("审核等待");
                tvStatus.setTextColor(Color.parseColor("#8E9CA2"));
                ivStatus.setImageResource(R.mipmap.icon_auditwait);
                break;

            case 1: //审核通过
                tvStatus.setText("审核通过");
                tvStatus.setTextColor(Color.parseColor("#62B4AE"));
                ivStatus.setImageResource(R.mipmap.icon_auditpass);
                break;
            case 2:  //不通过
                tvStatus.setText("审核驳回");
                tvStatus.setTextColor(Color.parseColor("#E05959"));
                ivStatus.setImageResource(R.mipmap.icon_auditcourt);
                break;
            case 3:  //撤销
                tvStatus.setText("审核撤销");
                tvStatus.setTextColor(Color.parseColor("#4C96DC"));
                ivStatus.setImageResource(R.mipmap.icon_cancel);
                break;
        }
    }
}
